package com.sinothk.hussars.controller;


import com.sinothk.hussars.entity.RecordEntity;
import com.sinothk.hussars.entity.RecordInvalidEntity;
import com.sinothk.hussars.service.RecordInvalidService;
import com.sinothk.hussars.service.RecordService;
import com.sinothk.server.support.annotation.callback.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.sinothk.hussars.base.BaseController;

/**
 * <p>
 * 检查记录表 前端控制器
 * </p>
 *
 * @author liangyt
 * @since 2021-01-02
 */
@Api(tags = "记录相关功能")
@RestController
@RequestMapping("/record")
@ResponseResult()
public class RecordController extends BaseController {
    private final RecordService recordService;

    public RecordController(RecordService recordService) {
        this.recordService = recordService;
    }

    @ApiOperation(value = "新增记录")
    @PostMapping("/save")
    public RecordEntity save(@RequestBody RecordEntity recordEntity) {
        try {
            recordService.save(recordEntity);
            return recordEntity;
        } catch (Exception e) {
            throw new RuntimeException(e.getMessage());
        }
    }
}


